package com.bruce.asurada.exception;

import com.bruce.asurada.enums.BusinessErrorEnum;

/**
 * 业务异常类
 */
public class BusinessException extends RuntimeException {
    private int code;  // 错误编码
    private String message; // 错误信息

    public BusinessException(int code, String message){
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(BusinessErrorEnum businessErrorEnum){
        super(businessErrorEnum.getMessage());
        this.code = businessErrorEnum.getCode();
        this.message = businessErrorEnum.getMessage();
    }

    public int getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }    
}
